<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .box{
            width: 100%;
        }
        .box1{
            width: 100%;
            height: 50px;
            background: lavender;
        }
        .liang{
            background: crimson;
            color: white;
            border: 0;
            width: 100px;
            height: 30px;
            line-height: 30px;
            border-radius: 5px;
            margin: 10px;
        }
        .sou{
            width: 150px;
            height: 18px;
            border-radius: 3px;
            margin: 10px;
        }
        .py{
            border-radius: 3px;
            background-color: #ccb2c6;
        }
        table{
            margin-top: 15px;
            width: 100%;
            border-collapse: collapse;
            text-align: center;
        }
        th{
            border: 1px solid silver;
        }
        th:active{color: red}
        th:hover{color: red}
        td{
            border: 1px solid silver;
        }
            .kuang{
                margin-left:30%;
                font-family: 宋体;
                font-size: 14px;
                font-weight:bold;
            }
        .lyy{
            width: 1000px;
            height: 30px;
            margin-top: 22%;
            margin-left: 48%;
        }
        .sb{
            border: 0;
            background: #2D93CA;
            margin-top: -3px;
            width: 70px;
            height: 30px;
            border-radius: 5px;
        }
        .zhuan1{
            width: 50px;
            height: 20px;
        }
        .zhuan2{
            border: solid;
            color: #2D93CA;
            font-weight: bold;
            font-size: 20px;
            background: transparent;

            border: 0;
        }
        .dao{
            font-family: 黑体;
            font-size: 17px;
        }
        .fa{
            background-color: #a1adcc;
        }
        .btn{
            background: orange;
            color: white;
            border: 0;
            width: 80px;
            height: 30px;
            border-radius: 5px;
        }
    </style>
    <script src="/resources/js/jquery-1.7.1.min.js" type="application/javascript"></script>
    <script src="/resources/js/jquery-ui-1.8.10.custom.min.js" type="text/css"></script>
</head>
            <script>
                $(function () {
                    readList(1);
                    $.getJSON("/selectCategory",{},function (data) {
                        $("#leibie").empty();
                        var leibie = '<option value="">全部</option>';
                        for(var i = 0 ;i < data.length;i++){
                            var lei = data[i];
                            leibie +='<option>'+lei.category+'</option>'
                        }
                        $("#leibie").append(leibie);
                    })
                });
                function jiantou() {
                    var x = $("input[name='zhuan']").val();
                    readList(x);
                }
                function readList(pageNum) {
                    if(pageNum ==1){
                        pageNum = 1;
                    }
                    var formData = $("#form1").serialize();
                    formData += "&pageNum="+pageNum;
                    $.ajax({
                        url:"/selectPurchase",
                        data:formData,
                        dataType:"json",
                        type:"post",
                        success:function (data) {
                            da = data;
                            var table = "";
                            var list = data.list;
                            $("#table").empty();
                            for(var i = 0; i < list.length;i++){
                                var zhi = list[i];
                                table +='<tr>' +
                                    '<td>'+zhi.id+'</td>'+
                                    '<td><input type="checkbox" class="checkMin" value="'+zhi.deId+'" onclick="checkMin()"/></td>' +
                                    '<td>'+zhi.hospitalName+'</td>'+
                                    '<td>'+zhi.purchaseNum+'</td>'+
                                    '<td>'+zhi.purchaseName+'</td>'+
                                    '<td>'+zhi.dataName+'</td>'+
                                    '<td>'+zhi.beginTime+'</td>'+
                                    '<td>'+zhi.overTime+'</td>'+
                                    '<td>'+zhi.createTime+'</td>'+
                                    '<td>'+zhi.submitTime+'</td>'+
                                    '<td>'+zhi.auditorTime+'</td>'+
                                    '<td><button class="btn">查看</button></td>'+
                                    '</tr>'
                            }
                            $("#table").append(table);
                        }
                    })
                }
                function checkMax() {
                    var check=$(".checkMax").prop("checked");
                    $(".checkMin").prop('checked',check);
                }
                function checkMin() {
                    var chec=true;
                    $.each($(".checkMin"),function (index,item) {
                        if($(item).prop("checked")==false){
                            chec=false;
                        }
                    })
                    $(".checkMax").prop('checked',chec);
                }
                function selectMaintainIdList() {
                    var idList=new Array();
                    $.each($(".checkMin"),function (index,item) {
                        if($(item).prop("checked")==true){
                            idList.push($(item).val());
                        }
                    });
                    if(idList.length != 0){
                        location.href="/selectPurchaseByIdList?idList="+idList;
                    }else{
                        alert("请勾选需导出的信息！")
                    }
                }
            </script>
<body>
<div class="box">
    <h3>采购单查询交易统计</h3>
    <hr>
    <form action="" method="post" id="form1" class="fa">
    <div class="kuang">
        采购单编号:
        <input type="text" placeholder="采购单编号" class="sou" name="purchaseNum"/>
        采购单名称：
        <input type="text" placeholder="采购单名称" class="sou" name="purchaseName"/>
        <br/>
        采购单状态：
        <select type="text"class="sou" name="purchaseState" id="zhuangtai">
            <option value="">全部</option>
            <option value=1>未提交</option>
            <option value=2>审核中</option>
            <option value=3>审核通过</option>
            <option value=4>审核不通过</option>
        </select>
        &nbsp;
        采购医院:
        <input type="text" placeholder="采购医院" class="sou" name="hospitalName"/>
        <br/>
        &nbsp;
        供货商：
        <input type="text" placeholder="输入供货商" class="sou" name="providerName"/>
        &nbsp;
        药品类别:
        <select class="sou" id="leibie" name="drugCategory">
            <option value="">全部</option>
        </select>
        <br/>
        药品流水号:
        <input type="text" placeholder="输入药品流水号" class="sou" name="serialNumber"/>
        &nbsp;
        通用名：
        <input type="text" placeholder="输入通用名" class="sou" name="commonName"><input class="py" type="button" value="拼音首子母搜索">
        <br/>
        &nbsp;&nbsp;
        剂型：
        <input type="text" placeholder="输入剂型" class="sou" name="dosageForm">
        &nbsp;&nbsp;
        规格：
        <input type="text" placeholder="输入规格" class="sou" name="size">
        <br>
        &nbsp;&nbsp;
        单位:
        <input type="text" placeholder="输入单位" class="sou" name="unit">
        &nbsp;
        转换系数:
        <input type="text" placeholder="输入转换系数" class="sou" name="factor">
        <br>
        生产企业：
        <input type="text" placeholder="输入生产企业" class="sou" name="productionName">
        &nbsp;&nbsp;
        商品名:
        <input type="text" placeholder="输入商品名" class="sou" name="commodityName">
        <br/>
    </div>
    </form>
</div>
<div class="box1">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <button class="liang" onclick="readList(1)">查询</button>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <button class="liang" onclick="selectMaintainIdList()">导出</button>
</div>
<table>
    <thead>
    <tr>
        <th>序号</th>
        <th><input type="checkbox" class="checkMax" onclick="checkMax()"/>全选 </th>
        <th>采购医院</th>
        <th>采购单编号</th>
        <th>采购单名称</th>
        <th>采购状态</th>
        <th>开始采购时间</th>
        <th>结束采购时间</th>
        <th>建单时间</th>
        <th>提交时间</th>
        <th>审核时间</th>
        <th>详细</th>
    </tr>
    </thead>
    <tbody id="table">

    </tbody>
</table>
<div class="lyy" style="margin: 10px">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <button class="sb" onclick="readList(1)">首页</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <button class="sb" onclick="readList(da.prePage)">上一页</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <button class="sb" onclick="readList(da.nextPage)">下一页</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <button class="sb" onclick="readList(da.pages)">尾页</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <span class="dao">转到</span><input class="zhuan1" name="zhuan" type="text"><span class="dao">页</span><button class="zhuan2"><span class="jian" onclick="jiantou()">⇨</span></button>
</div>
</body>
</html>
